<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:62:"E:\WWW\zhihui\public/../application/home\view\goods\index.html";i:1528782303;s:62:"E:\WWW\zhihui\public/../application/home\view\public\base.html";i:1528783919;}*/ ?>
<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" type="text/css" href="__ROOT__/static/home/css/reset.css"/>
	<link rel="stylesheet" type="text/css" href="__ROOT__/static/home/css/style.css"/>
	<link rel="stylesheet" type="text/css" href="__ROOT__/static/home/css/foundation-datepicker.css"/>
	<link rel="stylesheet" type="text/css" href="__ROOT__/static/home/css/font-awesome.css"/>
	<script src="__ROOT__/static/home/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
	<title></title>
</head>


<body onload="myFunction()">
<div class="bj">
	<audio id="mp3" src="__ROOT__/static/home/remind.mp3"> </audio>
	<!--头部-->
	
	<div class="head">
		<div class="h-top">
			<ul>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a></li>
			</ul>
			<div class="clear"></div>
		</div>
		<div class="h-name">
			<div class="name">
				<div class="logo left">
					<a href="#"><img src="__ROOT__/static/home/img/logo.png" style="height: 40px;"/></a>
				</div>
				<div class="assistant right">
					<div class="img">
						<img src="__ROOT__/static/home/img/assistant.png"/>
					</div>
					<div class="b-div">
						<img src="__ROOT__/static/home/img/assistant.png"/>
						<p class="t2 open-wing"><a>修改密码</a></p>
						<p class="t2"><a href="<?php echo URL('business/index'); ?>">账号设置</a></p>
						<p class="t2"><a href="<?php echo URL('index/quitLogin'); ?>">退出登录</a></p>
					</div>
				</div>

			</div>
		</div>
	</div>
	
	<!--内容-->
	<div class="c">
		<div class="content">
			
			<div class="c-l left">
				<div class="c-left">
					<div class="list">
						<div class="">
							<i></i><span>统计分析</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('index/index'); ?>">概况分析</a></li>
							<li><a href="<?php echo URL('index/user'); ?>">用户分析</a></li>

						</ul>

					</div>



					<div class="list">
						<div class="">
							<i></i><span>图片管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('banner/index'); ?>">图片管理</a></li>
						</ul>

					</div>

					<div class="list">
						<div class="">
							<i></i><span>产品管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('commtype/index'); ?>">分类管理</a></li>
							<li><a href="<?php echo URL('goods/index'); ?>">信息展示管理</a></li>
							<!-- <li><a href="<?php echo URL('freight/index'); ?>">运费模板管理</a></li> -->

						</ul>
					</div>

					<div class="list">
						<div class="">
							<i></i><span>会员管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('user/index'); ?>">会员列表</a></li>
							<li><a href="<?php echo URL('user/indexs'); ?>">刚刚访问用户</a></li>
						</ul>
					</div>

					<div class="list">
						<div class="">
							<i></i><span>订单管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('order/index'); ?>">待付款</a></li>
							<li><a href="<?php echo URL('order/delivergoods'); ?>">待发货</a></li>
							<li><a href="<?php echo URL('order/takegoods'); ?>">待收货</a></li>
							<li><a href="<?php echo URL('order/complete'); ?>">已完成</a></li>

							<li><a href="<?php echo URL('order/occlude'); ?>">已关闭</a></li>

						</ul>

					</div>

					<div class="list">
						<div class="">
							<i></i><span>资产管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('record/index'); ?>">交易记录</a></li>
						</ul>
					</div>
					<div class="list">
						<div class="">
							<i></i><span>产品管理</span>
						</div>
						<ul>
							<li><a href="<?php echo URL('cate/index'); ?>">产品分类管理</a></li>
						</ul>
					</div>
					<!--<div class="list">-->
						<!--<div class="">-->
							<!--<i></i><span>优惠券</span>-->
						<!--</div>-->
						<!--<ul>-->
							<!--<li><a href="<?php echo URL('coupon/index'); ?>">优惠券列表</a></li>-->


						<!--</ul>-->
					<!--</div>-->
					<!--<div class="list">-->
						<!--<div class="">-->
							<!--<i></i><span>评论管理</span>-->
						<!--</div>-->
						<!--<ul>-->
							<!--<li><a href="<?php echo URL('comment/index'); ?>">评论列表</a></li>-->


						<!--</ul>-->
					<!--</div>-->

					<div class="list">
						<div class="">
							<i></i><span>基本设置</span>
						</div>
						<ul>
							<!--<li><a href="">基本设置</a></li>-->
							<li><a href="<?php echo URL('express/index'); ?>">快递设置</a></li>

							<li><a href="<?php echo URL('payments/index'); ?>">支付设置</a></li>

							<li><a href="<?php echo URL('business/index'); ?>">商家基本信息</a></li>
							<!--<li><a href="">管理员信息</a></li>-->
						</ul>
					</div>
					<div class="list">
						<div class="">
							<a href="<?php echo URL('payments/buss'); ?>"><i></i><span>店铺管理</span></a>
						</div>
						<!--<ul>-->
							<!--&lt;!&ndash;<li><a href="">基本设置</a></li>&ndash;&gt;-->
							<!--<li><a href="<?php echo URL('express/index'); ?>">快递设置</a></li>-->

							<!--<li><a href="<?php echo URL('payments/index'); ?>">支付设置</a></li>-->

							<!--<li><a href="<?php echo URL('business/index'); ?>">商家基本信息</a></li>-->
							<!--&lt;!&ndash;<li><a href="">管理员信息</a></li>&ndash;&gt;-->
						<!--</ul>-->
					</div>

				</div>

			</div>

			<!--<div id="main" style="width: 600px;height:400px;"></div>-->
			
			


			
<input type="hidden" name="mun_url" id="mun_url" value="2,1"/>
<style>
	.c-r .label-3 .Tab table td button{margin:3px 5px 3px 0;}
	.icon{border-radius:4px ;cursor: pointer;padding: 3px 9px;text-indent: -999999999px;}
	.icon_up{background: url("../../static/home/img/icon_ups.png") no-repeat center;background-size:20px 15px;
			background-color: #39f;}
	.icon_buttom{background: url("../../static/home/img/icon_buttom.png") no-repeat center;background-size:20px 15px;
			background-color: #39f;}	
	.icon_up2{background: url("../../static/home/img/icon_up2.png") no-repeat center;background-size:20px 15px;
			background-color: #39f;}
	.icon_buttom2{background: url("../../static/home/img/icon_buttom2.png") no-repeat center;background-size:20px 15px;
			background-color: #39f;}					
</style>
<div class="c-r right">
	<div class="label1">
		<div class="title">
			信息展示管理
		</div>
		<div class="label-3 label">
			<div class="search">
				<div class="">
					<input type="text" name="" id="" value="" placeholder="信息展示名称"/><button id="search_name"><i></i><span>搜信息展示</span></button>
				</div>
			</div>
			<div class="Statistics">
				<button class="blue"><a href="add">添加信息展示</a></button>

				<div class="" style="display: inline-block;margin-left: 46px">
					<div class="bor bor2 bor6 bor_two">
						<span>请选择</span><i></i>
						<ul style="display: none;">

						</ul>
					</div>
					<div class="bor bor2 bor7 bor_two">
						<span>请选择</span><i></i>
						<ul style="display: none;">

						</ul>
					</div>
					<div class="bor bor2 bor8 bor_two">
						<span>请选择</span><i></i>
						<ul style="display: none;">

						</ul>
					</div>
					<button class="blue" id="search">搜索</button>
				</div>
				<div class="clear"></div>
			</div>

			<div class="Tab Tabs">
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<tr>
						<th style="width: 40px;"><input type="checkbox" name="" id="" value="" /></th>
						<th style="width: 60px;">ID</th>
						<th style="width: 80px; ">图片</th>
						<th style="width: 180px;">信息展示名</th>
						<th style="width: 70px;">单价</th>
						<th style="width: 70px;">销量</th>
						<th style="width: 75px;">总库存</th>
						<th style="width: 80px;">推荐</th>
						<th style="width: 70px;">排序</th>
						<th style="width: 80px;">发布状态</th>
						<th style="width: 180px;">操作</th>
					</tr>
				</table>
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$vo): ?>
					<tr>
						<td style="width: 40px;"><input type="checkbox" name="" id="" value="" /></td>
						<td style="width: 60px;" class="goodsid" id="goodsid"><?php echo $vo['goodsid']; ?></td>
						<td style="width: 80px;"><img src="<?php echo $vo['pic']; ?>" style="width: 60px;"/></td>
						<td style="width: 180px;" class="align-r"><?php echo $vo['name']; ?></td>
						<td style="width: 70px;" class="align-r"><?php echo $vo['min_price']; ?></td>
						<td style="width: 70px;" class="align-r"><?php echo $vo['sales']; ?></td>
						<td style="width: 75px;" class="align-r"><input type="text" name="" id="" class="" onblur="upajax(<?php echo $vo['goodsid']; ?>,'inventory',this)" value="<?php echo $vo['stock']; ?>" style="width: 60px;"></td>

						<td style="width: 80px;" class="align-r"><?php echo $vo['recomm']; ?></td>
						<td style="width: 70px;" class="align-r"><?php echo $vo['sort']; ?></td>
						<td style="width: 80px; text-align: center" class="green">
							<b><?php echo $vo['status']; ?></b>
						</td>
						<?php if($vo['status'] == '已上架'): ?>
						<td style="width: 180px;">
							<button class="openbtn ml bottom shelves" onclick="shelves($(this),0)">下架</button>
							<button class="modifybtn ml open-win" data-type="show?id=<?php echo $vo['goodsid']; ?>">查看</button>
							<button onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>')" class="modifybtn ml">编辑</button>
							<button class="ml icon icon_up" onclick="compile('editSort?id=<?php echo $vo['goodsid']; ?>&index=1')">向上</button>
							<button class="ml icon icon_buttom" onclick="compile('editSort?id=<?php echo $vo['goodsid']; ?>&index=2')">向下</button>
							<button class="ml icon icon_up2" onclick="compile('editSort?id=<?php echo $vo['goodsid']; ?>&index=3')">置顶</button>
							<button class="ml icon icon_buttom2" onclick="compile('editSort?id=<?php echo $vo['goodsid']; ?>&index=4')">置后</button>
						</td>

						<?php elseif($vo['status'] == '已下架'): ?>
						<td style="width: 180px;">
							<button class="modifybtn ml top" onclick="shelves($(this),1)">上架</button>
							<button class="modifybtn ml open-win" data-type="show?id=<?php echo $vo['goodsid']; ?>">查看</button>
							<button class="modifybtn ml" onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>')">编辑</button>
							<button class="ml icon icon_up" onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>&index=1')">向上</button>
							<button class="ml icon icon_buttom" onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>&index=2')">向下</button>
							<button class="ml icon icon_up2" onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>&index=3')">置顶</button>
							<button class="ml icon icon_buttom2" onclick="compile('edit?id=<?php echo $vo['goodsid']; ?>&index=4')">置后</button>
						</td>

						<?php endif; ?>
						</tr>
					<?php endforeach; endif; else: echo "" ;endif; ?>
				</table>

			</div>
			<div style="text-align: center" class="pages">
				<?php echo $data->render(); ?>
			</div>


		</div>
	</div>
</div>

<div id="wrap" class="wrap">
	<div class="wrap-body express">
		<div class="title">
			详情查看
		</div>
		<iframe src="show" style="height: 100%; width: 100%;"></iframe>
		<span class="close-wrap close-win">×</span>
		<div class="wrap-btn">
			<span class="close-btn close-win">取消</span>
			<span class="next-btn close-win">确认</span>
		</div>
	</div>
</div>

<script type="text/javascript">
	//	green
		 $(function () {
			 var leng = $('.Tab tr')
			 for (var i = 0; i < leng.length; i++){
				 var txt = leng.eq(i).find('.green b').text()
				 //alert(txt)
				 if(txt == '已上架'){
					 leng.eq(i).find('.green b').addClass('putaway')
				 }
				 if(txt == '已下架'){
					 leng.eq(i).find('.green b').addClass('sold ')
				 }
			 }

		 })

		$(".open-win").click(function(){
			var dataurl = $(this).attr('data-type');
			$("iframe").attr('src',dataurl)
		})






	function shelves(j,v){
		var pid = j.parent().parent().find('.goodsid').text()
		var data = {
			goodsid:pid,status:v,
		};
		$.ajax({
			type:'post',
			url:"__publicPath__/home/goods/soldOut",			//请求地址加参数
			data: data,
			success: function(data){
				window.location.reload();
					//Parent.find('.green').addClass('red')

			},
			error:function(){
				alert('更新失败')
			}
		});
	}

	var Ptid_one = $("#class_one");   //获取每级id
	var Ptid_tow = $("#class_two");
	var Ptid_three = $("#class_three");
	var Level = "0";   //获取级别

	$(".bor6").unbind('click').bind('click',function(){
		$(".bor7 ul li").remove()
		//alert('-')
		var	are = '';
		$.ajax({
			type:"get",
			url:"__publicPath__/home/commtype/ajaxindex",
			data: '',
			dataType: "json",
			success: function(data){
				//alert(data[1].title)
				for (var i = 0; i < data.length; i++){      //一级分类
					//alert(data[i].title)
					are += "<li data-type="+data[i].tid+">"+data[i].name+"</li>";
					Level = data[i].level
					//console.log(Level)
					//$(".bor6 ul").html('')
					//alert('1')
					//alert($(".bor6 ul").html('666'))
//						for (var j = 0; j < data[i].sub.length; j++) {   //二级菜单
//							//alert(data[i].sub[j].title)
//						}
				}
				$(".bor6 ul").html('')
				$(".bor6 ul").append(are)
			},
			error:function(){
				alert('失败')
			}
		});
	})

	var Li;  				//一级索引
	var towLi;				//二级索引
	//二级分类
	$(document).on("click", ".bor6 ul li", function(){
		$(".bor7 ul li").remove()
		$(".bor7 span").text('请选择')
		$(".bor8 ul li").remove()
		$(".bor8 span").text('请选择')
		Li = $(this).index()
		var	are = '';
		$.ajax({
			type:"get",
			url:"__publicPath__/home/commtype/ajaxindex",
			data: '',
			dataType: "json",
			success: function(data){
				for (towLi = 0; towLi < data[Li].sub.length; towLi++) {   //二级菜单
					are += "<li data-type="+data[Li].sub[towLi].ptid+">"+data[Li].sub[towLi].name+"</li>"
					Level = data[Li].sub[towLi].level
				}
				$(".bor7 ul").html('')
				$(".bor7 ul").append(are)
				//console.log(Level)
			},
			error:function(){
				alert('失败')
			}
		});
	})

	//三级分类
	$(document).on("click", ".bor7 ul li", function(){
		$(".bor8 span").text('请选择')
		var stowLi = $(this).index()
		var	are = '';
		$.ajax({
			type:"get",
			url:"__publicPath__/home/commtype/ajaxindex",
			data: '',
			dataType: "json",
			success: function(data){
				for (var i = 0; i < data[Li].sub[stowLi].sub.length; i++) {   //三级菜单
					//alert(data[Li].sub[stowLi].sub[i].title)
					are += "<li data-type="+data[Li].sub[stowLi].sub[i].ptid+">"+data[Li].sub[stowLi].sub[i].name+"</li>"
					Level = data[Li].sub[stowLi].sub[i].level
				}
				$(".bor8 ul").html('')
				$(".bor8 ul").append(are)
				//console.log(Level)
			},
			error:function(){
				alert('失败')
			}
		});
	})


	$("#search").click(function(){
		var pid_one = $(".bor6 span").attr('data-type');
		var pid_two = $(".bor7 span").attr('data-type');
		var pid_three = $(".bor8 span").attr('data-type');

//		var data = {
//			pid_one:pid_one,
//			pid_two:pid_two,
//			pid_three:pid_three
//		}
		window.location.href='goodssearch?pid_one='+pid_one+'&pid_two='+pid_two+'&pid_three='+pid_three;
//		$.ajax({
//			type:"get",
//			url:"data/select.json",
//			data: data,
//			dataType: "json",
//			success: function(data){
//
//			},
//			error:function(){
//				alert('失败')
//			}
//		});
	})

	$("#search_name").click(function(){
		var searchname = $(this).parent().find('input').val()
		if (searchname == '' || searchname == undefined) {
		} else{
			window.location.href='goodssearch?name='+searchname;
//			var data = {name:searchname}
//			$.ajax({
//				type:"get",
//				url:"data/select.json",
//				data: data,
//				dataType: "json",
//				success: function(data){
//
//				},
//				error:function(){
//					alert('失败')
//				}
//			});
		}

	})
</script>


			<!--<div id="main" style="width: 600px;height:400px;"></div>-->
		</div>

	</div>

	<!--尾部-->
	
	<div class="foot">
		Copyright © 2016 - 2017 qingful.com All Rights Reserved
	</div>
	
	<!--返回顶部-->


</div>

<script src="__ROOT__/static/home/js/js.js" type="text/javascript" charset="utf-8"></script>
<script>
    //索引0开始
    var mun_url = $('#mun_url').val();											//获取页面参数
    var arrmun_url = mun_url.split(",")				                           //转成数组格式
    var leftul = $(".c .c-l .list ul").eq(arrmun_url[0]).find('li').length		//获取元素数量
    $(".c .c-l .list ul").eq(arrmun_url[0]).css('height',50*leftul)				//设置高度
    $(".c .c-l .list ul").eq(arrmun_url[0]).find('li').eq(arrmun_url[1]).attr('class','act')//添加样式
//    function myFunction(){
        setInterval(function () {
            $.ajax({
                url:"<?php echo url('index/send'); ?>",
                dataType:'json',
                success:function (data) {
                    if(data.res == 1){
                        $('#mp3')[0].play();
                    }
                },
            })
        },10000)

        var modify = '<div id="wrap" class="modifys"><div class="wrap-body modify"><div class="title">修改密码</div><form action="/home/index/regpwd" method="post" id="modify">'+
            '<div class=""><label>输入旧密码：</label><input type="password" name="oldpwd" id="oldpwd" value="" onblur="upmodifys(this)"/></div>'+
            '<div class=""><label>设置新密码：</label><input type="password" name="pwd" id="pwd" value="" /></div>'+
            '<div class=""><label>确认新密码：</label><input type="password" name="upwd" id="upwd" value="" /></div><div class="sub"><input type="button" value="确认" class="sub"/></div>'+
            '</form><span class="close-wrap close-wing">×</span></div></div>'
        $("body").append(modify);
    //    var urlform = "<?php echo url('index/pwd'); ?>"
    //    $("#modify").attr("action",urlform)
    var Submit = true;
	$('.close-wing').click(function () {
		$('.modifys').fadeOut()
    })
    function regular(regular,j,txt) {
        var mail = regular;
        var j = $("#"+j).val()
        //alert(j)
        if (j == '' || j == null) {
            prompt("密码不可为空",0)
            return false;
        }
        if(mail.test(j)){
            //console.log('正确')
        }else{
            prompt(txt,0)
            //console.log('错误')
            return false;
        }
        return true
    }
    function upmodifys(o){
        var val = $(o).val()
        if (val == '' || val == null) {
            prompt("请输入旧密码",0)
            //Submit = false;
        } else{
            $.ajax({
                type:"post",
                url:"<?php echo url('index/pwd'); ?>",
                data:{
                    date:val
                },
                success:function(data){
                    //console.log(data)
                    if (data == 1) {
                        Submit = true;
                    } else{
                        prompt("旧密码输入错误",0)
                        Submit = false;
                    }
                }
            });
        }
    }
    var name_regular = /^[A-Za-z0-9]{4,40}$/     //姓名验证

    $('#modify .sub input').click(function () {
        var oldpwd = $("#oldpwd").val()
        var pwd = $('#pwd').val()
        var pwds = $('#upwd').val()
        if(oldpwd == "" || oldpwd == null){
            prompt("请输入旧密码",0)
            return false;
        }

        if (Submit == false) {
            prompt("旧密码输入错误",0)
            return false;
        }
        if(oldpwd == pwd){
            prompt("旧密码不能与新密码相同",0)
            return false;
        }
        if (!regular(name_regular,'oldpwd','旧密码格式错误') || !regular(name_regular,'pwd','新密码格式错误')) {
            return false
        }else if(pwds == '' || pwds == null){
            prompt("请再次输入密码",0)
            return false;
        }
        if (pwds != pwd) {
            prompt("密码输入不统一",0)
            return false;
        }
        $.ajax({
            type:"post",
            url:"<?php echo url('index/regpwd'); ?>",
            data:{
                pwd:pwd
            },
            success:function(data){
                window.location.reload()
            }
        });
    })
</script>
</body>
</html>








